import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
public class ADemo {
    public static void main(String[] args) throws IOException {
        Connection.Response connection;
        String url ="s";
        connection = Jsoup.connect("http://my.oschina.net/abely/blog").ignoreContentType(true).userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36").execute();
        Document doc = connection.parse();
        while(url!="") {
//            Elements likes = doc.select(".like #like");
//            for (Element element : likes) {
//                System.out.print(element.text() + ",");
//            }
//            System.out.println();
//            Elements reads = doc.select(".read #read");
//            for (Element element : reads) {
//                System.out.print(element.text() + ",");
//            }
//            System.out.println();
//            Elements favors = doc.select(".favor #favor");
//            for (Element element : favors) {
//                System.out.print(element.text() + ",");
//            }



        if(doc.select("#list > div.pages.sm-hide > ul > li").last().text().equals("下一页")){
            url= doc.select("#list > div.pages.sm-hide > ul > li").last().select("a").attr("href");
        }
            System.out.println(url);
        }
    }
}
